package com.tanhua.manager.controller;

import com.tanhua.manager.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/manage")
public class ManageController {

    @Autowired
    private ManageService manageService;

    @GetMapping(value = "/users",name = "分页查询用户")
    public ResponseEntity queryUsers(@RequestParam(defaultValue = "1") Integer page,
                                     @RequestParam(defaultValue = "10")Integer pagesize,
                                     Long id,
                                     String nickname,
                                     String city
                                     ){

        return manageService.queryUsers(page,pagesize,id,nickname,city);
    }

    @GetMapping(value = "/users/{userID}",name = "查询用户详细信息")
    public ResponseEntity queryUsersById(@PathVariable("userID") Long userId){

        return manageService.queryUsersById(userId);
    }

    @GetMapping(value = "/videos",name = "查询指定用户的小视频列表数据")
    public ResponseEntity queryVideos(@RequestParam(defaultValue = "1") Integer page,
                                      @RequestParam(defaultValue = "10")Integer pagesize,
                                      Long uid){

        return manageService.queryVideos(page,pagesize,uid);
    }

    @GetMapping(value = "/messages",name = "查询指定用户的动态（圈子）列表数据")
    public ResponseEntity queryMessages(@RequestParam(defaultValue = "1") Integer page,
                                      @RequestParam(defaultValue = "10")Integer pagesize,
                                      Long uid,Integer state){

        return manageService.queryMessages(page,pagesize,uid,state);
    }

    @GetMapping(value = "/messages/{id}",name = "查询指定动态（圈子）详情数据")
    public ResponseEntity queryMessagesDetail(@PathVariable("id") String movementId){

        return manageService.queryMessagesDetail(movementId);
    }

    @GetMapping(value = "/messages/comments",name = "查询指定动态（圈子）的评论数据")
    public ResponseEntity queryComments(@RequestParam(defaultValue = "1") Integer page,
                                        @RequestParam(defaultValue = "10")Integer pagesize,
                                        String messageID){

        return manageService.queryComments(page,pagesize,messageID);
    }
}
